/**
 * StkUtils
 * <p/>
 * User: joakimd
 * Date: 2013-03-12
 * Time: 12:04
 */
package org.dru.stk {
public final class StkUtils {
    public function StkUtils(guard: Guard) {
    }

    public static function fill(dst: Vector.<Number>, val: Number, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dst[pos] = val;
        }
    }

    public static function fillS(dstL: Vector.<Number>, dstR: Vector.<Number>, val: Number, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dstL[pos] = val;
            dstR[pos] = val;
        }
    }

    public static function copy(dst: Vector.<Number>, src: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dst[pos] = src[pos];
        }
    }

    public static function copyM2S(dstL: Vector.<Number>, dstR: Vector.<Number>, src: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dstL[pos] = src[pos];
            dstR[pos] = src[pos];
        }
    }

    public static function copyS2M(dst: Vector.<Number>, srcL: Vector.<Number>, srcR: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dst[pos] = (srcL[pos] + srcR[pos]) * 0.5;
        }
    }

    public static function copyS2S(dstL: Vector.<Number>, dstR: Vector.<Number>, srcL: Vector.<Number>, srcR: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dstL[pos] = srcL[pos];
            dstR[pos] = srcR[pos];
        }
    }

    public static function add(dst: Vector.<Number>, src: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dst[pos] += src[pos];
        }
    }

    public static function addM2S(dstL: Vector.<Number>, dstR: Vector.<Number>, src: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dstL[pos] += src[pos];
            dstR[pos] += src[pos];
        }
    }

    public static function addS2M(dst: Vector.<Number>, srcL: Vector.<Number>, srcR: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dst[pos] += (srcL[pos] + srcR[pos]) * 0.5;
        }
    }

    public static function addS2S(dstL: Vector.<Number>, dstR: Vector.<Number>, srcL: Vector.<Number>, srcR: Vector.<Number>, start: int, end: int): void {
        for (var pos: int = start; pos < end; pos++) {
            dstL[pos] += srcL[pos];
            dstR[pos] += srcR[pos];
        }
    }
}
}

class Guard {
}